package com.method;

/*
定义方打印1~n之间的和
*/
public class Demo03 {
    public static void main(String[] args) {

        int resout = sum(1, 9);
        System.out.println(resout);

    }

    public static int sum(int a, int b) {
        int sum = 0;
        for (int i = a; i <= b; i++) {
            sum += i;
        }
        return sum;
    }
}
